<?php
$this->pageTitle = t('PAGE_TITLE', 'gallery');
$this->breadcrumbs = array('Gallery');
?>
<div class="component_heading">
    <h1><?php echo CHtml::encode(t('PAGE_TITLE', 'gallery')) ?></h1>
</div>
<div class="component_content">
    <ul class="gallery">
	<?php
	if ($arrAlbum == null || !count($arrAlbum)) {
	    echo t('NO_RESULT_FOUND');
	} else {
	    foreach ($arrAlbum as $album) {
		$imgPath = MEDIA_FOLDER . DS . "gallery" . DS . $album->picture;
		?>
		<li>
		    <div style="width: <?php echo LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH ?>px; height: <?php echo LGConstant::FRONTEND_GALLERY_IMAGE_HEIGHT ?>px;">
			<?php
			$img = '';
			if (!file_exists($imgPath)) :
			    $imgPath = MEDIA_URL . DS . "gallery" . DS . LGConstant::FRONTEND_GALLERY_NO_PHOTO;
			    $img = CHtml::image($imgPath, '', array('style' => 'max-width:' . LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH
					. 'px; max-height: ' . LGConstant::FRONTEND_GALLERY_IMAGE_HEIGHT . 'px;')
			    );

			else :


			    $img = CHtml::image(url('gallery/thumbnails', array('f' => $imgPath,
					'w' => LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH,
					'h' => LGConstant::FRONTEND_GALLERY_IMAGE_HEIGHT)
					    ), '', array('style' => 'max-width:' . LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH
					. 'px; max-height= ' . LGConstant::FRONTEND_GALLERY_IMAGE_HEIGHT . 'px;')
			    );
			endif;

			$url = url('gallery/photo', array('id' => $album->id,
			    'alias' => stringURLSafe($album->name)));
			echo CHtml::link($img, $url);
			?>
		    </div>
		    <div style="width: <?php echo LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH ?>px; height: 38px;overflow: hidden;vertical-align: middle;">
			<?php echo CHtml::link(CHtml::encode($album->name), $url); ?>
		    </div>
		</li>
		<?php }
	}
	?>
    </ul>
</div>